<?php
/**
 * Created by PhpStorm.
 * User: Cao
 * Date: 07/10/2014
 * Time: 15:51
 */
class resizeImg
{
    public function __construct()
    {

    }
    protected $image_library="gd2";
    protected $create_thumb= TRUE;
    protected $maintain_ratio= TRUE;
    protected $width=60;
    protected $height=30;

    public function thumb($url){
        $this->load->library('image_lib');
        $config['image_library'] = $this->image_library;
        $config['new_image']= "./template/home/image/thumbnail_{$url}";
        $config['source_image']	= $url;
        $config['create_thumb'] = $this->create_thumb;
        $config['maintain_ratio'] = $this->maintain_ratio;
        $config['width']	= $this->width;
        $config['height']	= $this->height;
        $this->load->library('image_lib', $config);
        return $this->image_lib->resize();
    }
}